﻿@model CultuRAM.Models.RegisterModel

<table id="usersTab" class="table table-hover table-striped table-bordered" style="width:100%;">
    <tr style="font-size: 12px">
        <th>
            @Html.DisplayNameFor(model => model.UserName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.RoleName)
        </th>
    </tr>

    @foreach (var item in Model.UsersProfile)
    {
        <tr id="@item.UserId">
            <td>
                @Html.DisplayFor(modelItem => item.UserName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Roles.GetRolesForUser(item.Email).Single()
            </td>
        </tr>
    }
</table>

<div class="row-fluid pagination-botton">
    <div class="span6">
        <div id="cmdEvents float-left">
          
            @Html.Raw(@Ajax.ActionLink("replacetxt", "Register", "Account",null,
                             new AjaxOptions
                                 {
                                     UpdateTargetId="userManager", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET", 
                                     OnComplete = "UserBgColorAdd()"       
                                 }, new { @class = "btn btn-success btn-xs", id="btnAddUser" }) 
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-plus icon-white\"></i> Adicionar"))     
            
             @Html.Raw(@Ajax.ActionLink("replacetxt", "Edit", "Account",null,
                             new AjaxOptions
                                 {
                                     UpdateTargetId="userManager", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET",
                                     OnComplete = "UserBgColorEdit()"  
                                 }, new { @class = "btn btn-warning btn-xs", id="btnEditUser" }) 
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-pencil icon-white\"></i> Editar"))
            
            @Html.Raw(@Ajax.ActionLink("replacetxt", "Delete", "Account", null,
                             new AjaxOptions
                                 {
                                     UpdateTargetId="userManager", 
                                     InsertionMode = InsertionMode.Replace, 
                                     HttpMethod = "GET",
                                     OnComplete = "UserBgColorDel()"  
                                 }, new { @class = "btn btn-danger btn-xs", id="btnDelUser" }) 
		                        .ToHtmlString().Replace("replacetxt", "<i class=\"icon-remove icon-white\"></i> Eliminar"))        
        </div>
    </div>
    <div class="span6" style="padding-right: 30px;">
        <div class="float-right">
            <div class="pagination" style="margin: 0;">
                <ul>
                    
                    @if (Model.UsersProfile.HasPreviousPage)
                    {
                        <li>
                            @Ajax.ActionLink("<<", "ListUsersPv", new { page = 1 },
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="listUsers", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                        <li>
                            @Ajax.ActionLink("<", "ListUsersPv", new { page = Model.UsersProfile.PageNumber - 1},
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="listUsers", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                         <li class="">
                            <a href="#" data-original-title="" title="" class="disabled">
                                Página <b> @(Model.UsersProfile.PageCount < Model.UsersProfile.PageNumber ? 0 : Model.UsersProfile.PageNumber)</b> de <b> @Model.UsersProfile.PageCount </b>
                            </a>
                        </li>  
                    }
                    else
                    {
                        <li class="disabled"><a href="#" data-original-title="" title="" class="">«</a></li> 
                        <li class="disabled"><a href="#" data-original-title="" title="" class=""><</a></li> 
                        <li class="">
                            <a href="#" data-original-title="" title="" class="disabled">
                                Página <b> @(Model.UsersProfile.PageCount < Model.UsersProfile.PageNumber ? 0 : Model.UsersProfile.PageNumber)</b> de <b> @Model.UsersProfile.PageCount </b>
                            </a>
                        </li>
                           
                        
                    }
               
                    @if (Model.UsersProfile.HasNextPage)
                    {
                        <li>
                            @Ajax.ActionLink(">", "ListUsersPv", new { page = Model.UsersProfile.PageNumber + 1 },
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="listUsers", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                        <li>
                            @Ajax.ActionLink(">>", "ListUsersPv", new { page = Model.UsersProfile.PageCount },
                                             new AjaxOptions
                                                 {
                                                     UpdateTargetId="listUsers", 
                                                     InsertionMode = InsertionMode.Replace, 
                                                     HttpMethod = "GET" 
                                                 }, new { @class = ""}) 
                        </li>
                    }
                    else
                    {
                        <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">></a></li> 
                        <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">»</a></li>
                    }
                
                </ul>
            </div>
        </div>

    </div>
</div>


@Scripts.Render("~/bundles/culturam")